<?php
	require_once("View/memberView.php");
	require_once("Model/memberModel.php");
	
	class MemberController
	{
		public function DoControll(Database $db)
		{
			$mm = new MemberModel($db);
			$mv = new MemberView();
			
			$html = $mv->RenderHeader(MemberView::ADD_MEMBER_HEADER);
			
			$html .= $mv->RenderCreateMember();
			
			if($mv->TriedToCreate() == true)
			{
				$mm->AddMember($mv->GetFirstName(), $mv->GetLastName(), $mv->GetSocialNumber());
			}
			
			$html .= $mv->RenderHeader(MemberView::LIST_MEMBER_HEADER);
			
			$memberList = $mv->RenderList($mm->GetMembers());
			
			$html .= $memberList;
			
			return $html;
		}
			
	}

?>